package com.softer.chengxin.excel.dao;

import com.softer.chengxin.home.domin.Street;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Gong Zhiyang
 * @date 2019/2/19
 */
@Mapper
@Repository
public interface ExcelStreetDao {
    /**
     * 获取地区下拉列表
     *
     * @param parentId 地区的父级ID
     * @param id       登陆账号ID
     * @return 地区列表
     */
    @Select("select a.id,a.`name` as label from district_street a LEFT JOIN manager_user b ON FIND_IN_SET(a.id,b.area) WHERE a.parent_id=#{parentId} and b.id=#{id}")
    List<Street> getExcelStreet(@Param("parentId") String parentId, @Param("id") Integer id);
}
